package com.smyk.btchina.view.main.fragment

import androidx.fragment.app.Fragment
import com.smyk.btchina.base.BaseMvvmFragment
import com.smyk.btchina.databinding.FragmentHomeBinding
import com.smyk.btchina.view.main.fragment.home_sub.ColumnFragment
import com.smyk.btchina.view.main.fragment.home_sub.InfoFragment
import com.smyk.btchina.view.main.fragment.home_sub.TitleFragment
import com.smyk.btchina.view_model.HomeViewModel

/**
 * @des
 * @date 2021/9/7
 * @author sam
 */
class HomeFragment : BaseMvvmFragment<FragmentHomeBinding, HomeViewModel>() {

    private val mInfoFragment by lazy { InfoFragment() }
    private val mTitleFragment by lazy { TitleFragment() }
    private val mColumnFragment by lazy { ColumnFragment() }
    private val mSubFragments by lazy { ArrayList<Fragment>() }
    private val mTitle by lazy { arrayOf("头条", "专题", "专栏") }

    override fun getViewModel(): HomeViewModel = HomeViewModel()

    override fun getViewBing(): FragmentHomeBinding = FragmentHomeBinding.inflate(layoutInflater)

    override fun initView() {
        mSubFragments.add(mInfoFragment)
        mSubFragments.add(mColumnFragment)
        mSubFragments.add(mTitleFragment)
        mBinding.tabHome.setViewPager(mBinding.vpHome, mTitle, activity, mSubFragments)

    }
}